<template>
  <div class="content_box">
      
      <div class="lanmu_box">
        <div class="line_box">
          <p class="line"></p>
          <p class="text">常用功能</p>
        </div>
   
        <div class="admin_list_box">
          <div class="box" @click="toRoom">
            <img src="/static/images/index_icon2.png" alt="">
            <p class="text">房间管理</p>
          </div>
          <div class="box" @click="toType">
            <img src="/static/images/index_icon3.png" alt="">
            <p class="text">房间类型</p>
          </div>
          <div class="box" @click="toLabel">
            <img src="/static/images/index_icon3.png" alt="">
            <p class="text">房间标签</p>
          </div>
        </div>
      
      </div>
      
      <div class="lanmu_box">
        <div class="line_box">
          <p class="line"></p>
          <p class="text">营销管理</p>
        </div>
       
        <div class="admin_list_box">
          <div class="box" @click="toCoupon">
            <img src="/static/images/index_icon4.png" alt="">
            <p class="text">优惠券管理</p>
          </div>
          <div class="box" @click="toCZ">
            <img src="/static/images/index_icon5.png" alt="">
            <p class="text">充值管理</p>
          </div>
          <div class="box" @click="toVip">
            <img src="/static/images/index_icon2.png" alt="">
            <p class="text">会员管理</p>
          </div>
          <div class="box" @click="toHd">
            <img src="/static/images/index_icon1.png" alt="">
            <p class="text">活动管理</p>
          </div>
          <div class="box" @click="toStar" v-if="role == 'admin'">
            <img src="/static/images/index_icon1.png" alt="">
            <p class="text">攒星卡券</p>
          </div>
          <div class="box" @click="toFavorableAdmin" v-if="role == 'admin'">
            <img src="/static/images/index_icon1.png" alt="">
            <p class="text">好评返现审核</p>
          </div>
          <div class="box" @click="toAddUser" v-if="role == 'admin'">
            <img src="/static/images/index_icon2.png" alt="">
            <p class="text">员工管理</p>
          </div>
          <div class="box" @click="tokbCoupon" v-if="role == 'admin'">
            <img src="/static/images/index_icon1.png" alt="">
            <p class="text">捆绑优惠券</p>
          </div>
          <div class="box" @click="tocommodity" v-if="role == 'admin'">
            <img src="/static/images/index_icon1.png" alt="">
            <p class="text">商品管理</p>
          </div>
          <div class="box" @click="tocommoditytype" v-if="role == 'admin'">
            <img src="/static/images/index_icon1.png" alt="">
            <p class="text">商品类型</p>
          </div>
          <div class="box" @click="totimeCard" v-if="role == 'admin'">
            <img src="/static/images/index_icon1.png" alt="">
            <p class="text">加时卡</p>
          </div>
        </div>
      </div>
  </div>
</template>
 
<script>
import { mapState,mapActions } from 'vuex'
import {
  getStoreBase,
  getStoreCutList,
  selectMyStore,
  getStoreHomePage,
  getLatestOrder,
} from "@/api/index";
export default {
  components: {},
  data() {
    return {
      statusBarHeight: "", // 状态栏高度
      titleBarHeight: "", // 标题栏高度
      navBarHeight: "", // 导航栏总高度
      isStore:false,
      storeMsg:{},
      isTrue:false,
      storeList:[],
      showSkeleton:false,
      bannerIndex:0,
      query:{
        type:0
      },
      dataMsg:{},
      lanmu:[
        {name:'今天',type:0},
        {name:'上周',type:6},
        {name:'本周',type:5},
        {name:'本月',type:3},
        {name:'全部',type:4}
      ],
      lanmuIndex:0,
      newOrderMsg:{},
    };
  },
  onShow() {
    console.log(this.role)
    // this.getStoreMsg()
  },
  onLoad(options) {
    
  },
  computed: {
    ...mapState({
      role: state => state.user.role,
    })
  },
  methods: {
    ...mapActions( ['updateStoreId']),

    // 跳转加时卡
    totimeCard(){
      wx.navigateTo({
        url: `/pages/home/timeCardAdmin/main`,
      });
    },

    // 跳转商品类型
    tocommoditytype(){
      wx.navigateTo({
        url: `/pages/home/commodityType/main`,
      });
    },

    // 跳转商品管理
    tocommodity(){
      wx.navigateTo({
        url: `/pages/home/commodityAdmin/main`,
      });
    },

    // 跳转vip
    toVip(){
      wx.navigateTo({
        url: `/pages/home/vipAdmin/main`,
      });
    },

    // 跳转活动管理
    toHd(){
      wx.navigateTo({
        url: `/pages/home/hdAdmin/main`,
      });
    },

    // 跳转攒星
    toStar(){
      wx.navigateTo({
        url: `/pages/home/starAdmin/main`,
      });
    },

    // 好评返现
    toFavorableAdmin(){
      wx.navigateTo({
        url: `/pages/home/favorableAdmin/main`,
      });
    },

    // 跳转负责人管理
    toFzr(){
      wx.navigateTo({
        url: `/pages/home/fzrAdmin/main`,
      });
    },

    // 跳转员工管理
    toAddUser(){
      this.$toast('功能即将开放！')
      return
      wx.navigateTo({
        url: `/pages/home/userAddAdmin/main`,
      });
    },

    // 跳转提现
    toTx(){
      this.$toast('功能即将开放！')
      return
      wx.navigateTo({
        url: `/pages/home/fundAdmin/main`,
      });
    },

    // 跳转捆绑优惠券
    tokbCoupon(){
      wx.navigateTo({
        url: `/pages/home/kbCouponAdmin/main`,
      });
    },

    // 跳转流水
    toLiushui(){
      wx.navigateTo({
        url: `/pages/home/detailedAdmin/main`,
      });
    },

    // 跳转合伙人页面
    toPartner(){
      wx.navigateTo({
        url: `/pages/home/partnerAdmin/main`,
      });
    },


    // 跳转订单
    toOrder(){
      wx.navigateTo({
        url: `/pages/home/orderAdmin/main`,
      });
    },

    // 跳转续费
    toRenew(){
      console.log(this.storeMsg)
      wx.navigateTo({
        url: `/pages/home/renew/main`,
      });
    },

    // 跳转优惠券
    toCoupon(){
      console.log(this.storeMsg)
      wx.navigateTo({
        url: `/pages/home/couponAdmin/main`,
      });
    },

    // 跳转房间管理
    toRoom(){
      wx.navigateTo({
        url: `/pages/home/roomAdmin/main`,
      });
    },

    // 跳转房间类型
    toType(){
      wx.navigateTo({
        url: `/pages/home/roomTypeAdmin/main`,
      });
    },

    // 跳转房间标签
    toLabel(){
      wx.navigateTo({
        url: `/pages/home/roomLabelAdmin/main`,
      });
    },

    // 跳转充值管理
    toCZ(){
      wx.navigateTo({
        url: `/pages/home/rechargeAdmin/main`,
      });
    },

    // 跳转创建店铺
    toAdd(){
      this.isStore = false
      wx.navigateTo({
        url: `/pages/addStore/main?isEdit=0`,
      });
    },

    // 跳转设备管理
    toSb(){
      wx.navigateTo({
        url: `/pages/home/sbAdmin/main`,
      });
    },
    
    // 选择店铺
    // changeStore(){
    //   this.isStore = true
    // },


  },
  beforeMount() {
    const self = this;
    wx.getSystemInfo({
      success(system) {
        console.log(`system:`, system);
        self.statusBarHeight = system.statusBarHeight;
        let platformReg = /ios/i;
        if (platformReg.test(system.platform)) {
          self.titleBarHeight = 44;
        } else {
          self.titleBarHeight = 48;
        }
        self.navBarHeight = self.statusBarHeight + self.titleBarHeight;
      },
    });
  },
  onHide() {},
  onUnload() {
  },
  // 下拉刷新
  onPullDownRefresh(){
    //在当前页面显示导航条加载动画
    wx.showNavigationBarLoading();
    // this.getStoreMsg()
  },
  onTabItemTap(){
    wx.vibrateShort({type:'heavy'});
  },
  onShareAppMessage() {
    return {
      title: '杠小二商家端',
      path: `/pages/home/main`,
      // imageUrl:'https://yxzw.oss-cn-chengdu.aliyuncs.com/rich/20230116/WXGTafGfYHjvPGQtJABM.png'
    }
 },
};
</script>

<style lang="scss" scoped>
.content_box {
  min-height: 100vh;
  background: #f5f5f5;
  padding-top:1rpx;
  
  .lanmu_box{
    background: #fff;
    width: 92%;
    margin:30rpx auto 0 auto;
    border-radius: 20rpx;
    padding-bottom:30rpx;
    .line_box{
      display: flex;
      align-items: center;
      padding:30rpx;
      padding-bottom:0;
      .line{
        width: 6rpx;
        height: 30rpx;
        background: #1E6AFF;
      }
      .text{
        font-size:30rpx;
        font-weight: 500;
        margin-left:10rpx;
      }
    }
  }
  .admin_list_box{
    .box{
      width: 33%;
      margin-top:50rpx;
      font-size:28rpx;
      font-size:#333;
      display: inline-block;
      text-align: center;
    }
    img{
      width: 60rpx;
      height: 60rpx;
      margin-bottom:10rpx;
    }
  }
}
</style>
